<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
            list-style: none;
        }
        .main{
            width: 600px;
            height: 800px;
            border: 1px solid black;
            margin: 50px auto;
        }
        .box{
            width: 600px;
            height: 100px;
        }
        .box ul li{
            width: 200px;
            height: 100px;
            background-color: pink;
            float: left;
            text-align: center;
            line-height: 100px;
        }
        .boxs ul{
            width: 600px;
            height: 700px;
            background-color: skyblue;
            display: none;
        }
        .boxs ul li{
            width: 300px;
            height: 350px;
            float: left;
            text-align: center;
            line-height: 350px;
        }

        .box ul li.active{
            background-color: aqua;

        }
        .boxs ul.on{
            display: block;
        }
    </style>
</head>
<body>
    <div class="main">
        <div class="box">
            <ul>
                <li class="active">菜单1</li>
                <li>菜单2</li>
                <li>菜单3</li>
            </ul>
        </div>

        <div class="boxs">
            <ul class="on">
                <li>内容1</li>
                <li>内容1</li>
                <li>内容1</li>
                <li>内容1</li>
            </ul>
            <ul>
                <li>内容2</li>
                <li>内容2</li>
                <li>内容2</li>
                <li>内容2</li>
            </ul>
            <ul>
                <li>内容3</li>
                <li>内容3</li>
                <li>内容3</li>
                <li>内容3</li>
            </ul>
    </div>

    <script>
        let lis=document.querySelectorAll(".box ul li")
        let uls=document.querySelectorAll(".boxs ul")
        console.log(lis,uls);
        lis.forEach(function(v,i){
            v.addEventListener("click",function(){
                for(let k=0;k<=lis.length-1;k++){
                    lis[k].classList.remove("active")
                    uls[k].classList.remove("on")
                }
                lis[i].classList.add("active")
                uls[i].classList.add("on")
            })
        })
    </script>
</body>
</html>